<!--<script type="text/javascript">jQuery.noConflict()</script>-->

<script type="text/javascript" language="javascript" src="<?php echo base_url() ?>media/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="<?php echo base_url() ?>media/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">
    $(document).ready(function() {
        $('#example').dataTable();
    } );

</script>

<link media="screen" rel="stylesheet" href="<?php echo base_url(); ?>css/colorbox.css" />
<!--<script src="<?php echo base_url(); ?>jscripts/jquery-latest.min.js" type="text/javascript"></script>-->
<script src="<?php echo base_url(); ?>jscripts/jquery.colorbox-min.js" type="text/javascript"></script>

<!--the end of popup-->
<script type="text/javascript">
    $(function()
    {
        $('#link_content').colorbox({opacity:0.3});

    });
</script>
<!--this is the end of stylesheet-->
<!--end search -->

<style type="text/css" title="currentStyle">
    @import "<?php echo base_url() ?>media/css/demo_page.css";
    @import "<?php echo base_url() ?>media/css/demo_table.css";
</style>
<div style="float: left; border: 0px #ccc solid;"><?php echo anchor('card/cardfolder', img('images/user_images/cancel.png'),array('title'=>'Back')); ?></div>
<div style="margin: 0 auto;width: 100%;height: auto;border: 0px #ccc solid;text-align: center;font-size: 20px;color:#5C9416;">Card Management</div><br/>
<div class="Tcontrol" style="margin: 0 auto; float: right;width:70px;height: auto;border: 1px #ccc solid;text-align: center;font-size: 20px;color:#006600;">
    <center><?php echo anchor('card/add', img('images/icon-32-new.png'), array('id' => 'link_content','title'=>'Add New Card')); ?><br/>
        <span style="font-size: 9px;">Add New</span></center>
</div><br/><br/>
<?php
//-----------this is define condition for echoing session message------------------

if ($this->session->userdata('addcard_ms')) {
    echo $this->session->userdata('addcard_ms');
    echo $this->session->unset_userdata('addcard_ms');
} else if ($this->session->userdata('delcard_ms')) {
    echo $this->session->userdata('delcard_ms');
    echo $this->session->unset_userdata('delcard_ms');
} else if ($this->session->userdata('edicard_ms')) {
    echo $this->session->userdata('edicard_ms');
    echo $this->session->unset_userdata('edicard_ms');
}
?>
<div class="task1" style="float: left; width: 100%;height: auto;border: 0px #ccc solid;padding: 5px;">
    <div class="full_width big"></div>
    <div id="demo">
        <table cellpadding="0" cellspacing="0" border="0" class="mytable" id="example" width="100%">
            <thead>
                <tr style="background-color:#5C9416;color:#FFF;border:1px;text-align: center;font-weight: lighter;">
                    <?php
                    echo '<th rowspan="2" >N<sup>o</sup></th>';
                    echo '<th rowspan="2" >Card Name</th>';
                    echo '<th rowspan="2">Card Type</th>';
                    echo'<th colspan="3">Price</th>';
                    echo '<th rowspan="2" >Quantity</th>';
                    echo '<th rowspan="2" >Action</th>';
                    echo '<tr  style="background-color:#FFF;color:#000;text-align: center;font-size:12px;">';
                    echo '<td>Price_Khmer</td>';
                    echo '<td >Price_Volunteer</td>';
                    echo '<td >Price_Other</td>';
                    echo '</tr>';
                    ?> 
                </tr>
            </thead>
            <tbody>
                <?php
                //-------------this is data that query from database-------------------
                //$getdata = $this->db->query('SELECT * from tbl_card inner join tbl_pricecard on tbl_card.car_id=tbl_pricecard.car_id join tbl_car_type on tbl_car_type.car_type_id=tbl_card.car_type_id');
                if ($getdata->num_rows() > 0) { // if condition is true have record
                    $i = 1;
                    $j = 0;
                    foreach ($getdata->result() as $rows) {// looping all record in database
                        $j++;
                        echo '<tr style="text-align:center;font-weight: lighter;" class="row';
                        echo $j % 2;
                        echo '">';
                        echo '<td >' . $i . '</td>';
                        echo '<td>' . $rows->car_name . '</td>';
                        echo '<td >' . $rows->car_type_name . '</td>';
                        echo '<td>$' . $rows->price_K . '</td>';
                        echo '<td >$' . $rows->price_V . '</td>';
                        echo '<td >$' . $rows->price_other . '</td>';
                        echo '<td >' . $rows->car_quantity . '</td>';
                        //if($admin==1){
                        echo '<td >' . anchor('card/delete/' . $rows->car_id, img(array('src' => 'images/web_images/icon-16-delete2.png', 'alt' => 'Delete', 'title' => 'Delete')), 'title=Delete onclick="return confirm(\'Are you sure you want to delete?\')"') . '|', anchor('card/edit/' . $rows->car_id, img(array('src' => 'images/web_images/icon-16-edit2.png', 'alt' => 'Edit', 'title' => 'Edit'))) . '</td>';

                        //}else
                        // echo '<td >' .anchor('card/edit/'. $rows->car_id,img(array('src'=>'images/web_images/icon-16-edit2.png','alt'=>'Edit','title'=>'Edit'))) . '</td>';
                        echo '</tr>';
                        $i++;
                    }
                } else { // if codition  is not true, cord is not have in database
                    echo '<tr >';
                    echo '<td colspan="8"><p style="color:red;text-align:center;">No card are found!</td></p>';
                    echo '</tr>';
                }
                ?>
            </tbody>
        </table>
    </div>
    <div class="spacer"></div>


    <h1>&nbsp;</h1>
    <h1>&nbsp;</h1>
</div>

